package com.winit.iwm.dubbo.provider.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.winit.iwm.storage.manager.UserManager;
import com.winit.iwm.storage.entity.User;
import com.winit.spi.iwm.TestService;
import com.winit.spi.iwm.command.TestCommand;
import com.winit.spi.iwm.exception.QueryException;
import com.winit.spi.iwm.vo.TestVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by jianke.zhang on 2017/4/19.
 */
@Service(interfaceClass = TestService.class)
@Component
public class TestServiceImpl implements TestService {

    @Autowired
    private UserManager userManager;

    @Override
    public TestVo hellWorld(TestCommand command) throws QueryException {

        User user = userManager.findByName(command.getName());
        TestVo vo = new TestVo();
        vo.setName(user.getName() + ", welcome to iwm.");
        return vo;
    }
}
